package com.example.demo.service.impl.gisImpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.demo.common.result.Result;
import com.example.demo.mapper.gisMapper.PipeLineMapper;
import com.example.demo.mapper.gisMapper.PipePointMapper;
import com.example.demo.model.DTO.NameTypeDTO;
import com.example.demo.model.DTO.NameTypeListDTO;
import com.example.demo.model.DTO.ParkingLotStatistics;
import com.example.demo.model.entity.GisEntity.Parking;
import com.example.demo.service.PipeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PipeImpl implements PipeService {
    @Autowired
    PipePointMapper pipePointMapper;
    @Autowired
    PipeLineMapper pipeLineMapper;

    @Override
    public Result getPipeLineGroupByType(){
        List<NameTypeListDTO> list =pipeLineMapper.getPipeLineGroupByType();
        QueryWrapper<Parking> qw = new QueryWrapper<>();
        for (NameTypeListDTO item : list) {
            List<NameTypeDTO> LineTypeList =pipeLineMapper.groupPipeLineByType(item.getName());
            item.setList(LineTypeList);
        }
        return  Result.ok().data("list",list);
    }
    @Override
    public Result getPipeLineGroupBySteet(){
        List<NameTypeDTO> list = pipeLineMapper.groupPipeLineGroupBySteet();
        return Result.ok().data("data",list);
    }

    @Override
    public Result getPipeLineGroupByOwner(){
        List<NameTypeDTO> list = pipeLineMapper.groupPipeLineGroupByOwner();
        return Result.ok().data("data",list);
    }

    @Override
    public  Result getPipePointGroupBySubsidiaryItem(){
        List<NameTypeDTO> list = pipePointMapper.getPipePointGroupBySubsidiaryItem();
        return Result.ok().data("data",list);
    }
}
